package com.xbongbong.parent.parse.data;

import com.alibaba.fastjson.JSONObject;
import com.xbongbong.paas.field.FieldAttrEntity;
import com.xbongbong.paas.pojo.dto.AnalysisDataDTO;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.saas.help.FormDataAnalysisHelp;
import org.springframework.stereotype.Component;

import java.util.Map;
import java.util.Objects;
import java.util.Set;

/**
 * 列表上快速编辑回显时解析数据
 * @author: wufeng
 * @date 2020/4/8 16:30
 * @desrcption:
 */
@Component
public class FormDataFastUpdateAnalysisDataHelp extends FormDataUpdateGetAnalysisDataHelp {

    @Override
    public void analysisData(AnalysisDataDTO analysisDataDTO, JSONObject resultJsonObject, Map<String, Object> linkData, Set<Object> linkDataSet) throws XbbException {
        FieldAttrEntity fieldAttrEntity = analysisDataDTO.getFieldAttrEntity();
        JSONObject objectJsonObject = analysisDataDTO.getDataJsonObject();
        // 判断高级规则
        // 审批摘要不判断高级权限
        if (Objects.isNull(analysisDataDTO.getIsProcess()) || !analysisDataDTO.getIsProcess()) {
            FormDataAnalysisHelp.invisibleSetNull(fieldAttrEntity, analysisDataDTO, objectJsonObject);
        }
        super.analysisData(analysisDataDTO, resultJsonObject, linkData, linkDataSet);
    }
}
